#ifndef Renderer_h__
#define Renderer_h__

typedef void*   RWndHandle;

typedef unsigned long long bigInt_t;

struct glConfig {
    int maxTextureUnit;
    int maxTextureSize;
};

struct RInitParams {
    int width;
    int height;
    int bpp;
    int multiSample;
    int _refreshRate;
};

enum RRendererType {
    RT_GLES1_1,
    RT_GLES2,
    RT_GL
};

class RenderWorld;

class RenderSystem {
public:
    virtual ~RenderSystem() {}

    virtual void    Init( RWndHandle hWnd, const RInitParams& params, RRendererType type = RT_GLES1_1 ) = 0;
    virtual void    Shutdown() = 0;
    virtual bool    IsInitialized() const = 0;

    virtual RRendererType   GetType() const = 0;
    virtual const glConfig& GetConfig() const = 0;

    virtual int     NumContexts() const = 0;
    virtual bool    CreateContext( RWndHandle hWnd, const RInitParams& params ) = 0;
    virtual void    ReleaseContext( RWndHandle hWnd ) = 0;
    virtual void    SelectContext( RWndHandle hWnd ) = 0;
    virtual void*   GetCurrentContext() const = 0;
    virtual void    MakeCurrentContext() = 0;

    virtual bigInt_t        NumberFrame() const = 0;
    virtual void            BeginFrame( int windowWidth, int windowHeight ) = 0;
    virtual void            EndFrame( int *frontEndMsec = 0, int *backEndMsec = 0 ) = 0;
    virtual void            PresentFrame() = 0;

    virtual RenderWorld *	AllocRenderWorld() = 0;
    virtual void            SetPrimaryWorld( RenderWorld* world ) = 0;
    virtual RenderWorld *   GetPrimaryWorld() const = 0;

    virtual void			TakeScreenshot( const char *fileName ) = 0;
};

extern RenderSystem*    renderSystem;

#endif // Renderer_h__